<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h3>父级数据</h3>
        <p>姓名：{{name}} 年龄：{{age}}</p>
        <my-component :age="age" :name="name"></my-component>
    </div>
    <template id="temp">
        <div id="">
            <h3>传到子组件修改后数据</h3>
            子组件姓名：{{myname}}, 年龄：{{myage}},爱好：{{love}}。
        </div>
    </template>
    <script type="text/javaScript" charset="UTF-8" src="/JS文件/vue.js"></script>
    <script>
        Vue.component("my-component",{
            props:{
            age:Number,
            name:String,
            love:{
                type:String,
                default:'red book'
            }, 
            },
            template:"#temp",
            data(){
                return {
                    myname:'小'+this.name,
                    myage:this.age-30
                } 
            }
        })
        var vm = new Vue({
                el:'#app',
                data:{
                    msg:'hello world',
                    age:'48',
                    name:'张三',
                }
        });
    </script>
</body>
</html>